package com.dyz.constant;

/**
 * 登录相关常量
 */
public class UserLoginConstant {

    public static final String ADMIN_CODE = "ROLE_ADMIN";
    //后台管理人员
    public static final String ADMIN_TYPE = "admin_type";

    //普通用户
    public static final String MEMBER_TYPE = "member_type";

    public static final String REFRESH_TOKEN="REFRESH_TOKEN";

    /**
     * 查询登录用户的sql
     */
    public static final String SQL_QUERY_USER_BY_USERNAME = "select id,password,status from user where mobile=? or email=?";

    public static final String SQL_QUERY_ADMIN_BY_USERNAME = "select id,password,status from sys_user where username=?";

    /**
     * 查询用户是否为管理员的sql
     */
    public static final String SQL_QUERY_USER_IS_ADMIN = "select code from sys_role left join sys_user_role on sys_role.id=sys_user_role.role_id where sys_user_role.user_id=?";
     /**
      * 查询所有权限
      */
     public static final String SQL_ALL_QUERY_PERMISSION = "select name from sys_privilege";
     /**
      * 查询用户权限
      */
     public static final String SQL_QUERY_PERMISSION_BY_USER_ID = "select name from sys_privilege left join sys_role_privilege on sys_privilege.id=sys_role_privilege.privilege_id left join sys_user_role on sys_role_privilege.role_id=sys_user_role.role_id where sys_user_role.user_id=?";

    /**
     * 根据用户id查询用户名
     */
    public static final String SQL_QUERY_USER_NAME_BY_USER_ID = "select mobile from user where id=?";
    /**
     * 根据管理员的id查询管理员的名字
     */
    public static final String SQL_QUERY_ADMIN_NAME_BY_ADMIN_ID = "select username from sys_user where id=?";
}
